package com.yswy.common.runnableUtil;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 注册各种业务线程池
 *
 * @author XiaoXuxuy
 * @date 2022/2/19 20:17
 */
@Configuration
public class ExecutorPoolConfig {

    /**
     * 工具类线程池
     *
     * @return
     */
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor ciToolExecutor() {
        TaskToolExecutor ciToolExecutor = new TaskToolExecutor();
        ciToolExecutor.setName("ciToolExecutor");
        ciToolExecutor.setCoreSize(15);
        ciToolExecutor.setMaxSize(32);
        ciToolExecutor.setQueueSize(1024);
        return ciToolExecutor;
    }


    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor imgEffect() {
        TaskToolExecutor msgExecutor = new TaskToolExecutor();
        msgExecutor.setName("imgEffect");
        msgExecutor.setCoreSize(1);
        msgExecutor.setMaxSize(2);
        msgExecutor.setQueueSize(1024);
        return msgExecutor;
    }
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor getImgEffectStats() {
        TaskToolExecutor msgExecutor = new TaskToolExecutor();
        msgExecutor.setName("getImgEffectStats");
        msgExecutor.setCoreSize(15);
        msgExecutor.setMaxSize(32);
        msgExecutor.setQueueSize(1024);
        return msgExecutor;
    }
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor tgCallBackIdInp() {
        TaskToolExecutor msgExecutor = new TaskToolExecutor();
        msgExecutor.setName("tgCallBackIdInp");
        msgExecutor.setCoreSize(50);
        msgExecutor.setMaxSize(100);
        msgExecutor.setQueueSize(2000);
        return msgExecutor;
    }

    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor producePackage() {
        TaskToolExecutor msgExecutor = new TaskToolExecutor();
        msgExecutor.setName("producePackage");
        msgExecutor.setCoreSize(15);
        msgExecutor.setMaxSize(32);
        msgExecutor.setQueueSize(1024);
        return msgExecutor;
    }
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public TaskToolExecutor stopTask() {
        TaskToolExecutor msgExecutor = new TaskToolExecutor();
        msgExecutor.setName("stopTask");
        msgExecutor.setCoreSize(15);
        msgExecutor.setMaxSize(32);
        msgExecutor.setQueueSize(1024);
        return msgExecutor;
    }

}

